<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
            function onGetFile() {
                alert(document.getElementById('form:readfile').value);
            }
        </script>
        <style type="text/css">
            .cancel {
                color: #ff0000;
            }

        </style>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px;">
            <h:form id="form" enctype="multipart/form-data">
                <p:messages id="msgs" showDetail="true"/>
                <p:focus for="readfile"/>
                <p:panel id="mdbread" style="width: 100%">
                    <h:panelGrid columns="2" style="width: 100%;">
                        <h:panelGrid id="pg" columns="4" style="text-align: right;">
                            <p:fileUpload id="readfile" required="true" dragDropSupport="true" style="width: 380px;"
                                          value="#{accessReadAction.mdbFile}"
                                          mode="simple"/>
                            <h:outputText value="密码：" style="margin-left: 30px;"/>
                            <p:inputText id="pwd" value="#{accessReadAction.pwd}" required="true"
                                         requiredMessage="必须输入密码！"/>

                        </h:panelGrid>
                        <p:commandButton value="开始读取" ajax="false"
                                         onclick="onGetFile();"
                                         actionListener="#{accessReadAction.onRead}"
                                         update="msgs"/>

                    </h:panelGrid>
                </p:panel>
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="/images/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value=""/>
                    </f:facet>
                </p:ajaxStatus>
            </h:form>
        </div>
    </ui:define>
</ui:composition>